<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<div class="col-md-11">
    <div class="iconsGroup">
        <a href="#" onclick=setCookie("language","nl")> <img src="<c:url value="/img/Icon_NL.png"/>" alt="Nederlands" title="Nederlands" class="languageIcon"/></a>
        <a href="#" onclick=setCookie("language","en")><img src="<c:url value="/img/Icon_EN.png"/>" alt="English" title="English" class="languageIcon"/></a>
    </div>
    <div class="iconsGroup">
        <a href="#" onclick=setCookie("currency","EUR-8364")><img src="<c:url value="/img/euro.png"/>" alt="Euro" title="Euro" class="languageIcon"/></a>
        <a href="#" onclick=setCookie("currency","GBP-163")><img src="<c:url value="/img/pound.png"/>" alt="British Pounds" title="British Pounds" class="languageIcon"/></a>
        <a href="#" onclick=setCookie("currency","USD-36")><img src="<c:url value="/img/dollar.png"/>" alt="Dollar" title="Dollar" class="languageIcon"/></a>
        <a href="#" onclick=setCookie("currency","JPY-165")><img src="<c:url value="/img/yen.png"/>" alt="Yen" title="Yen" class="languageIcon"/></a>
    </div>

</div>
   
<script>
    // When the page is being loaded, the cookie for currency needs to be set.
    window.document.onload=checkBeginCookie();
    
    // To begin with, the currency cookie needs to be set otherwise a 400 error will pop-up
    function checkBeginCookie() {
        if ( document.cookie.indexOf("currency=") === -1 ) {
           document.cookie="currency=EUR-8364";
         }
    }
    
    // With this function, several cookies can be set
    function setCookie(cname, cvalue) {
        if (document.cookie !== null) {
            document.cookie = cname + "=";
        }
        document.cookie = cname + "=" + cvalue;
        window.location.reload();
    }
</script>